<table width="100%" id="dsAccountTab" class="ctable" >
    <thead>
          <tr >
           <th align="center" width='3%'>順番</th>
           <th align="center" width='8%'>予約者</th>
           <th align="center" width='8%'>室</th>
           <th align="center" width='10%'>スタートタイミング</th>
           <th align="center" width='10%'>エンドタイミング</th>
           <th align="center" width='18%'>料金</th>
	     </tr>
    </thead>
    <tbody>
<?php
session_start();
/**
 * @author HIENDV
 * @copyright 2012
 */
include_once '../../../Model/Account.php';
$user = $_SESSION['username'];
$pass = $_SESSION['password'];
//$partner_id=$_SESSION['partner_id'];
$username=$_REQUEST['username'];
$name=$_REQUEST['name'];
$page=$_REQUEST['page'];
$per_page=$_REQUEST['per_page'];
/*$username='';
$name='';
$page=1;
$per_page=10;*/
$acc = new Account($user,$pass);
$rs=$acc->list_account($username,$name,1,$page,$per_page);
$totalpage=$acc->list_account($username,$name,2,$page,$per_page);
if($totalpage==0){
    echo '';
}else{
    $j=0;
    $result='';
    for($i=0;$i<count($rs);$i++){
    		$j=$i+1;
			if($rs[$i][15]==0) $st='普通'; else $st='ロックした';
    		$result=$result.'<tr id="tr'.$j.'" onclick="setColorOfRow(\''.$j.'\');edit_info_acc(this)">
    			<td align="center">'.$j.'<input type="hidden" value="'.date("d-m-Y",strtotime($rs[$i][5])).'"></td>
    			<td style="padding-left:2px;">'.$rs[$i][0].'</td>
    			<td style="padding-left:2px;">'.$rs[$i][1].'</td>
    			<td style="padding-left:2px;">'.$rs[$i][2].' '.$rs[$i][3].'<input type="hidden" value="'.$rs[$i][2].'"><input type="hidden" value="'.$rs[$i][3].'"></td>
    			<td style="padding-left:2px;">'.$rs[$i][10].'</td>
    			<td style="padding-left:2px;">'.$rs[$i][6].'<input type="hidden" value="'.$rs[$i][6].'"><input type="hidden" value="'.$rs[$i][16].'"></td>
    			<td style="padding-left:2px;">'.$rs[$i][8].'<input type="hidden" value="'.$rs[$i][8].'"><input type="hidden" value="'.$rs[$i][9].'"><input type="hidden" value="'.$rs[$i][11].'"></td>
				<td style="padding-left:2px;">'.$rs[$i][12].'<input type="hidden" value="'.$rs[$i][12].'"><input type="hidden" value="'.$rs[$i][17].'"></td>
				<td style="padding-left:2px;">'.$st.'<input type="hidden" value="'.$rs[$i][15].'"><input type="hidden" value="'.$rs[$i][7].'"></td>
				<td style="padding-left:2px;">'.$rs[$i][17].'<input type="hidden" value="'.$rs[$i][17].'"><input type="hidden" value="'.date("d-m-Y",strtotime($rs[$i][13])).'"><input type="hidden" value="'.date("d-m-Y",strtotime($rs[$i][14])).'"><input type="hidden" value="'.$rs[$i][4].'"></td>
    			<td align="center"><a href="javascript:detailInfoAccount(\'tr'.$j.'\')"><span title="Hiển thị thông tin chi tiết"><img src="lib/images/open.gif"></a>&nbsp;
				<a href="javascript:edit_info_acc(\'tr'.$j.'\')"></span><span title="Sửa thông tin account"><img src="lib/images/edit.gif" ></span></a>
				</span><a href="javascript:delete_account(\''.$rs[$i][0].'\')"><span title="Xóa account"><img src="lib/images/delete.jpg" onclick=""></span></td>
    			</tr>';
    }
    echo $result;
}
?>
</tbody></table>
<script type="text/javascript">
$(document).ready(function(){
$("#dsAccountTab tr:even").css("background-color","");
$("#dsAccountTab tr:odd").css("background-color","#F8F8F8");
});
function setColorOfRow(id){
	$("#dsAccountTab tr:even").css("background-color","");
	$("#dsAccountTab tr:odd").css("background-color","#F8F8F8");
	$("#tr"+id).css("background-color","#FBE0AA");
	}
</script>